package com.pgeg.mixin.item;

import com.pgeg.listener.ItemListener;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.List;

@Mixin(Item.class)
public class TooltipMixin {

    @Inject(method = "appendTooltip", at = @At("RETURN"))
    private void addTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context, CallbackInfo ci) {
        if (stack.isOf(ItemListener.RUNE_FIRE)) {
            tooltip.add(new TranslatableText("pgeg.tooltip.rune_fire.1").formatted(Formatting.DARK_RED));
            tooltip.add(new TranslatableText("pgeg.tooltip.rune_fire.2"));
            tooltip.add(new TranslatableText("pgeg.tooltip.rune_fire.3"));
            tooltip.add(new TranslatableText("pgeg.tooltip.rune_fire.4"));
        }
    }
}
